package com.hc.dfs.service.internet;

import java.net.MalformedURLException;

import com.google.gson.Gson;

/** 
 * @author 王洪胜  E-mail:  
 * @version 创建时间：2013-2-27 下午2:22:52
 * 
 * 类说明：
 *
 */
public  class Service {
	public   IService serviceApi;
	public 	Gson gson=new Gson();
	public   IService getServiceApi(){
		
		if(serviceApi==null){
			String url ="http://192.168.1.104:8080/DTDFS/mobile/service";
			com.caucho.hessian.client.HessianProxyFactory factory= new com.caucho.hessian.client.HessianProxyFactory();
			try {
				factory.setDebug(true);
	            factory.setHessian2Reply(false);
	            factory.setReadTimeout(5000);
	            serviceApi = (IService) factory.create(IService.class, url);
			} catch (MalformedURLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return serviceApi;
	}
	
//	public List<UnsignedNode> getSigningList(int userId,int operType, String key){
//		List<UnsignedNode> docs=new ArrayList<UnsignedNode>();
//		try {
//			String str=getServiceApi().getDocList(userId, operType, key);
//			Type type = new TypeToken<List<UnsignedNode>>(){}.getType();
//			 docs=new ArrayList<UnsignedNode>();
//			if(str!=null&&!str.equals("")){
//				docs=gson.fromJson(str, type); 
//			}else{
//				
//			}		
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		
//		return docs;
//	}
}
